﻿using CrawlerApp.Infrastructure.Data;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using Xunit.Abstractions;

namespace UnitTests
{
    public class BaseUnit
    {
        protected readonly ITestOutputHelper Out;
        protected readonly ApplicationDbContext context;
        protected int random { get { return new Random().Next(111111111, 999999999); } }
        public BaseUnit(ITestOutputHelper Out)
        {
            this.Out = Out;
            context = new ApplicationDbContext();
        }

        protected void OutPutJson<T>(T entity) where T : class
        {
            Out.WriteLine(JsonSerializer.Serialize<T>(entity, new JsonSerializerOptions { WriteIndented = true }));
        }
    }
}
